import { getIntl, getLocale } from 'umi';
const intl = getIntl(getLocale());
const isEn = intl.locale == 'en-US';
export const genderOptions = [
  // 男
  {
    label: intl.formatMessage({
      id: 'home.male',
    }),
    value: 1,
  },
  // 女
  {
    label: intl.formatMessage({
      id: 'home.female',
    }),
    value: 2,
  },
];
// 选择

export const chooseOptions = [
  // 否
  {
    label: intl.formatMessage({
      id: 'home.no',
    }),
    value: 0,
  },
  // 是
  {
    label: intl.formatMessage({
      id: 'home.yse',
    }),
    value: 1,
  },
];

export const chooseOptionsList = [
  // 否
  {
    label: intl.formatMessage({
      id: 'home.order.none',
    }),
    value: 0,
  },
  // 是
  {
    label: intl.formatMessage({
      id: 'home.order.right',
    }),
    value: 1,
  },
];

export const institutionTypeOptions = [
  {
    label: intl.formatMessage({
      id: 'home.banks',
    }),
    value: 1,
  },

  {
    label: intl.formatMessage({
      id: 'home.finance_company',
    }),
    value: 2,
  },
];

export const creditTypeOptions = [
  {
    label: intl.formatMessage({
      id: 'home.TU',
    }),
    value: 1,
  },

  {
    label: intl.formatMessage({
      id: 'home.TE',
    }),
    value: 2,
  },
];

export const approvalTypeOptions = [
  {
    label: intl.formatMessage({
      id: 'home.now',
    }),
    value: 1,
  },

  // {
  //   label: intl.formatMessage({
  //     id: 'home.face',
  //   }),
  //   value: 0,
  // },
];
export const operateIncomeOptions = [
  {
    label: intl.formatMessage({
      id: 'home.house_val',
    }),
    value: 1,
  },
  {
    label: intl.formatMessage({
      id: 'home.house_val1',
    }),
    value: 2,
  },
  {
    label: intl.formatMessage({
      id: 'home.house_val2',
    }),
    value: 3,
  },
  {
    label: intl.formatMessage({
      id: 'home.house_val3',
    }),
    value: 4,
  },
];
export const houseValOptions = [
  {
    label: intl.formatMessage({
      id: 'home.house_val',
    }),
    value: 1,
  },
  {
    label: intl.formatMessage({
      id: 'home.house_val1',
    }),
    value: 2,
  },
  {
    label: intl.formatMessage({
      id: 'home.house_val2',
    }),
    value: 3,
  },
  {
    label: intl.formatMessage({
      id: 'home.house_val3',
    }),
    value: 4,
  },
];
export const chinaName = {
  pattern: /^[\u4e00-\u9fa5]+$/,
  message: intl.formatMessage({ id: 'home.cnName_word' }),
};
export const enName = {
  pattern: /^[a-zA-Z]+$/,
  message: intl.formatMessage({ id: 'home.enName_word' }),
};

export const pattern = {
  pattern: /^[\u4e00-\u9fa5a-zA-Z0-9]+$/,
  message: intl.formatMessage({ id: 'home.no_word' }),
};

export const numberPattern = {
  pattern: /^[0-9]+$/,
  message: intl.formatMessage({ id: 'home.number_word' }),
};

export const emailPattern = {
  pattern: /^[a-zA-Z0-9_]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,6}$/,
  message: intl.formatMessage({ id: 'home.error_email' }),
};
export const noNumber = {
  pattern: /^[a-zA-Z\u4E00-\u9FFF]+$/,
  message: intl.formatMessage({ id: 'home.style_wrong' }),
};

export const passwordPattern = {
  pattern:
    /^(?=.*\d)(?=.*[a-zA-Z])(?=.*[*?!&￥$%^#,./@";:><\[\]}{\-=+_\\|》《。，、？’‘“”~ `]).{8,12}$/,
  message: intl.formatMessage({ id: 'home.password_wrong' }),
};
export const idCardPattern = {
  pattern: /^[A-Z]\d{6}$/,
  message: intl.formatMessage({ id: 'home.style_wrong' }),
};

export const phonePattern = {
  pattern: /^([4-9])\d{7}$/,
  message: intl.formatMessage({ id: 'home.phone_style_wrong' }),
};

export const dataFrommat = 'DD/MM/YYYY';

export const statusList = (value: string) => {
  switch (value) {
    case '1':
      return {
        color: '#FF8F00',
        bgColor: '#FFF6EA',
      };
    case '2':
    case '4':
      return {
        color: '#00A870',
        bgColor: '#E8F8F2',
      };
    case '3':
    case '5':
    case '7':
      return {
        color: '#FA5F30',
        bgColor: '#FFF1ED',
      };
    case '6':
      return {
        color: '#0270DF',
        bgColor: '#EBF5FF',
      };
  }
};
export const btnStatusList = (value: string) => {
  switch (value) {
    case '1':
      return {
        color: '#FF8F00',
        background: '#FFEED7',
      };
    case '2':
    case '4':
      return {
        color: '#43B649',
        background: '#D9FFDB',
      };
    case '3':
    case '5':
    case '7':
      return {
        color: '#FA5F30',
        background: '#FFE1D8',
      };
    case '6':
      return {
        color: '#0270DF',
        background: '#EBF5FF',
      };
  }
};

export const sortList = [
  {
    label: intl.formatMessage({ id: 'home.more_amout_top' }),
    value: 1,
  },
  {
    label: intl.formatMessage({ id: 'home.more_amout_bottom' }),
    value: 2,
  },
  {
    label: intl.formatMessage({ id: 'home.more_rate_top' }),
    value: 3,
  },
  {
    label: intl.formatMessage({ id: 'home.more_rate_bottom' }),
    value: 4,
  },
];

// 添加符号
export const addSign = (word: string | number | React.ReactNode) => {
  return `Hk$${word}`;
};

export const serviceList = [
  { title: 'center.about_company', word: '+', value: 100 },
  { title: 'center.about_order', word: intl.formatMessage({ id: 'home.pen1' }), value: 5000 },
  {
    title: 'center.about_amount',
    word: intl.formatMessage({ id: 'center.money_e' }),
    value: isEn ? 100 : 1,
  },
  {
    title: 'center.about_back',
    word: intl.formatMessage({ id: 'center.money_e1' }),
    value: 5,
  },
];

export const typeColor = [
  {
    key: '1',
    color: '#0065FD',
    bgColor: '#E4EFFF',
  },

  {
    key: '2',
    color: '#FD6A00',
    bgColor: '#FFF2E8',
  },
  {
    key: '3',
    color: '#09CEAB',
    bgColor: '#ECFBF8',
  },
  {
    key: '4',
    color: '#1FCB45',
    bgColor: '#EDFBF0',
  },
  {
    key: '5',
    color: '#CB1F1F',
    bgColor: '#F8E0E0',
  },
];
